package com.ftwj.demo.permission.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ftwj.demo.utils.validate.Phone;
import com.ftwj.demo.utils.validate.ValidateGroupKey;
import com.ftwj.demo.utils.validate.ValidateUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
* <p>Title: UserBean</p>  
* <p>Description: UserBean对象</p>
* <p>Copyright: Copyright (c) 2020 </p>  
* <p>Company: 兰州飞天网景信息产业有限公司</p>    
* @author WangSLi
* @date 2020年4月8日 下午3:50:48
* @version V1.0
 */
@TableName("tb_user")
@ApiModel(value="UserBean对象", description="")
public class UserBean implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(groups=ValidateGroupKey.class)
    @ApiModelProperty(value = "用户表主键")
    @TableId(value = "user_id", type = IdType.AUTO)
    private Integer userId;

    @TableField(condition="%s LIKE CONCAT('%%',#{%s},'%%') ")
    @ApiModelProperty(value = "账户显示名称")
    private String showName;
    
    @TableField(condition="%s LIKE CONCAT('%%',#{%s},'%%') ")
    @ApiModelProperty(value = "账户登录名称")
    private String loginName;

    @Phone
    @TableField(condition="%s LIKE CONCAT(#{%s},'%%') ")
    @ApiModelProperty(value = "用户手机号（作为用户登录名）")
    private String phone;

    @Pattern(regexp=ValidateUtil.REGEX_PASSWORD,message="密码必须为6~18的数字字母组合")
    @ApiModelProperty(value = "用户登录密码")
    private String password;

    @ApiModelProperty(value = "用户盐值")
    private String salt;

    @ApiModelProperty(value = "用户头像")
    private String avatar;

    @ApiModelProperty(value = "账号创建时间", hidden = true)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "账户创建人", hidden = true)
    private Integer createUser;

    @ApiModelProperty(value = "密码修改时间", hidden = true)
    private LocalDateTime modiTime;

    @ApiModelProperty(value = "密码修改人", hidden = true)
    private Integer modiUser;

    @ApiModelProperty(value = "用户最后登录时间")
    private LocalDateTime lastLoginTime;

    //@TableLogic
    @ApiModelProperty(value = "账号状态（1.正常，0.禁用，-1.删除）")
    private Integer state;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public String getShowName() {
        return showName;
    }

    public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public void setShowName(String showName) {
        this.showName = showName;
    }
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }
    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    public Integer getCreateUser() {
        return createUser;
    }

    public void setCreateUser(Integer createUser) {
        this.createUser = createUser;
    }
    public LocalDateTime getModiTime() {
        return modiTime;
    }

    public void setModiTime(LocalDateTime modiTime) {
        this.modiTime = modiTime;
    }
    public Integer getModiUser() {
        return modiUser;
    }

    public void setModiUser(Integer modiUser) {
        this.modiUser = modiUser;
    }
    public LocalDateTime getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(LocalDateTime lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }
    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return "UserBean{" +
        "userId=" + userId +
        ", showName=" + showName +
        ", loginName=" + loginName +
        ", phone=" + phone +
        ", password=" + password +
        ", salt=" + salt +
        ", avatar=" + avatar +
        ", createTime=" + createTime +
        ", createUser=" + createUser +
        ", modiTime=" + modiTime +
        ", modiUser=" + modiUser +
        ", lastLoginTime=" + lastLoginTime +
        ", state=" + state +
        "}";
    }
}
